package com.book.shop.repository;


import com.book.shop.model.Book;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface BookRepository extends JpaRepository <Book,Long>{

   @Query(value = "SELECT * FROM book WHERE bookname LIKE %?1% OR author LIKE %?1%", nativeQuery = true)
   public List<Book> searchBooks(String query);

   @Query("select p from Book p where p.bookIsbn like ?1")
   public Book searchByIsbn(String query);

}
